package com.ruoyi.dataSet.service;

import com.ruoyi.dataSet.DTO.DocumentCreateByFileRequest;
import com.ruoyi.dataSet.DTO.DocumentCreateRequest;
import com.ruoyi.dataSet.DTO.DocumentUpdateRequest;
import com.ruoyi.dataSet.http.HttpClient;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Service
public class DocumentService {

    // 创建文档
    public String createDocument(String datasetId, DocumentCreateRequest request) throws IOException {
        return HttpClient.createDocument(datasetId, request);
    }

    // 通过文件创建文档
    public String createDocumentByFile(String datasetId, String data, MultipartFile file) throws IOException {
        return HttpClient.createDocumentByFile(datasetId, data, file);
    }



    // 获取文档列表
    public String getDocuments(String datasetId, String page, String limit) throws IOException {
        return HttpClient.getDocuments(datasetId, page, limit);
    }

    // 删除文档
    public String deleteDocument(String datasetId, String documentId) throws IOException {
        return HttpClient.deleteDocument(datasetId, documentId);
    }

    // 更新文档内容
    public String updateDocument(String datasetId, String documentId, DocumentUpdateRequest request) throws IOException {
        return HttpClient.updateDocument(datasetId, documentId, request);
    }
}
